package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qf.mapper.DtsGoodsSpecificationMapper;
import com.qf.pojo.DtsGoodsSpecification;
import com.qf.service.DtsGoodsSpecificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author bss
 * @version V1.0
 * @Project maven
 * @Package com.qf.service.impl
 * @Description:
 * @Date 2022/10/17 22:36
 */
@Service
public class DtsGoodsSpecificationServiceImpl implements DtsGoodsSpecificationService {

    @Autowired
    DtsGoodsSpecificationMapper goodsSpecificationMapper;
    @Override
    public void insert(DtsGoodsSpecification specification) {

        specification.setAddTime(new Date());
        specification.setDeleted(false);
        specification.setUpdateTime(new Date());
        goodsSpecificationMapper.insert(specification);
    }

    @Override
    public void deleteByGoodsId(Integer id) {
        LambdaQueryWrapper<DtsGoodsSpecification> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(DtsGoodsSpecification::getGoodsId,id);
        goodsSpecificationMapper.delete(wrapper);
    }
}
